import java.util.Comparator;



public class PointYOrder implements Comparator<Point> {

	@Override
	public int compare(Point p1, Point p2) {
		//Not checking for null/empty pts
		
		if (p1 == p2)
			return 0;
		
		int p1y = p1.getyCoord();
		int p2y = p2.getyCoord();
		
		if (p1y == p2y) {
			if (p1.xCoord < p2.xCoord)
				return -1;
			else if (p1.xCoord > p2.xCoord)
				return 1;
			else
				return 0;
		}
		else if (p1y < p2y)
			return -1;
		else 
			return 1;

	}

}
